<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="Promise.js"></script>
</head>

<body>
    <script>
        // let p = new Promise((resolve, reject) => {
        //     console.log(1111);
        //     reject('ok');
        // })
        // p.then(value=>{
        //     console.log(222);
        // },reason=>{
        //     console.log(222);
        // })
        // console.log(333);

        // Promise.resolve('ok');
        /**
         * 1. 参数是非Promise 那么， fulfilled， 结果值就是 参数
         * 2. 参数是promise，那么，你成功我成功，你失败我失败
         * 
         */ 
        // let p1 = new Promise((resolve,reject)=>{
        //     reject('error');
        // })
        // let p2 = Promise.resolve(p1)
        // console.log(p2);


        console.log(Promise.resolve('ok'));
        console.log(Promise.resolve(new Promise((resolve,reject)=>{
            reject('error');
        })))

        console.log(Promise.reject(Promise.resolve('ok')));

    </script>

</body>

</html>